package com.dex4d.ui.qr.utils;

import android.app.Activity;

import com.dex4d.R;
import com.dex4d.dialog.CommonMessageDialog;
import com.dex4d.dialog.CustomDialog;
import com.dex4d.ui.qr.model.QRResult;

/**
 * 作者    LiQingyi
 * 时间    2018/11/22 20:00
 * 文件    dex4d-android
 * 描述
 */
public class TipUtils {

    /**
     * 错误信息提示对话框
     *
     * @param result
     */
    public static void showTips(final Activity activity, QRResult result) {
        CommonMessageDialog dialog = new CommonMessageDialog(activity, CommonMessageDialog.DialogStyle.TIP);
        dialog.setTitle(result.getError(activity));
        dialog.setMsg(activity.getResources().getString(R.string.tips_dialog_subtitle));
        dialog.setLeftBtnTxt(activity.getResources().getString(R.string.ok));
        dialog.setClickListener(new CustomDialog.CustomDialogOnClickListener() {
            @Override
            public void click(boolean flag) {
                activity.finish();
            }
        });
        dialog.show();
    }

    /**
     * 错误信息提示对话框
     *
     */
    public static void showUpgrade(final Activity activity) {
        CommonMessageDialog dialog = new CommonMessageDialog(activity, CommonMessageDialog.DialogStyle.NOTICE);
        dialog.setTitle("Find new verion ");
        dialog.setMsg(activity.getResources().getString(R.string.tips_dialog_subtitle));
        dialog.setLeftBtnTxt(activity.getResources().getString(R.string.ok));
        dialog.setClickListener(new CustomDialog.CustomDialogOnClickListener() {
            @Override
            public void click(boolean flag) {
            }
        });
        dialog.show();
    }

}
